package com.xyazm.inventory.controller;

import com.xyazm.common.redis.RedisCache;
import com.xyazm.inventory.domain.param.AddProductStockParam;
import com.xyazm.inventory.domain.param.ModifyProductStockParam;
import com.xyazm.inventory.domain.param.SyncStockToCacheParam;
import com.xyazm.inventory.service.IInventoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 正向下单流程接口冒烟测试
 * @author xuyou
 * @date 2022年08月06日 22:49
 */
@RestController
@RequestMapping("/inventory")
public class InventoryController {


    @Autowired
    private IInventoryService inventoryService;

    /**
     * 新增商品库存
     * @return
     */
    @PostMapping("/addProductStock")
    public void addProductStock(@RequestBody AddProductStockParam param) {
        inventoryService.addProductStock(param);
    }

    /**
     * 修改商品库存
     * @return
     */
    @PostMapping("/modifyProductStock")
    public void modifyProductStock(@RequestBody ModifyProductStockParam param) {
        inventoryService.modifyProductStock(param);
    }

    /**
     * 同步商品sku库存数据到缓存
     * @return
     */
    @PostMapping("/syncStockToCache")
    public void syncStockToCache(@RequestBody SyncStockToCacheParam param) {
        inventoryService.syncStockToCache(param);
    }


}
